import request from '@/utils/request'

// 分页查询发文列表
export function getDocSendPageList(query) {
    return request({
        url: '/doc/exchange/send/page',
        method: 'get',
        params: query
    })
}

//获取正文首页缩略图
export function getDocSendImage(id) {
    return request({
        url: '/doc/exchange/send/getDocImage/' + id,
        method: 'get',
        responseType: 'blob',
    })
}

// 查询发文记录信息
export function getDocSendRecord(id) {
    return request({
        url: '/doc/exchange/send/getRecord/' + id,
        method: 'get'
    })
}

// 查询公文基本信息
export function getDocSendBasicInfo(id) {
    return request({
        url: '/doc/exchange/send/getDocBasicInfo/' + id,
        method: 'get'
    })
}

// 查询指定公文的发文收文记录列表
export function getReceiveListByDocId(docId) {
    return request({
        url: '/doc/exchange/send/getReceiveListByDocId/' + docId,
        method: 'get'
    })
}

//打开最终文件（合并后的pdf）
export function getDocSendFinalFileInfo(id) {
    return request({
        url: '/doc/exchange/send/getFinalPageOfficeFile/' + id,
        method: 'get'
    })
}

//==========================单位收文===========================
// 分页查询收文列表
export function getDocReceivePageList(query) {
    return request({
        url: '/doc/exchange/receive/page',
        method: 'get',
        params: query
    })
}

export function getDocReceiveImage(id) {
    return request({
        url: '/doc/exchange/receive/getDocImage/' + id,
        method: 'get',
        responseType: 'blob',
    })
}

// 查询收文记录信息
export function getDocReceiveRecord(id) {
    return request({
        url: '/doc/exchange/receive/getRecord/' + id,
        method: 'get'
    })
}

// 查询收文基本信息
export function getDocReceiveBasicInfo(id) {
    return request({
        url: '/doc/exchange/receive/getDocBasicInfo/' + id,
        method: 'get'
    })
}

//是否有签收公文权限
export function getIsConfirmReceive(id) {
    return request({
        url: '/doc/exchange/receive/isConfirmReceive/' + id,
        method: 'get'
    })
}

//签收公文
export function confirmReceive(id) {
    return request({
        url: '/doc/exchange/receive/confirmReceive/' + id,
        method: 'PUT'
    })
}

//打开最终文件（合并后的pdf）
export function getDocReceiveFinalFileInfo(id) {
    return request({
        url: '/doc/exchange/receive/getFinalPageOfficeFile/' + id,
        method: 'get'
    })
}
